<template>
  <div class="content">
    <div class="href-box">
      <div class="href">
        <div class="link">首页</div>
        <icon name="iconxiangyoubeifen16" size="14" />
        <!-- <div class="link">活动</div>
        <icon name="iconxiangyoubeifen16" size="14" /> -->
        <div class="link">
          {{ goods.name }}
        </div>
      </div>
    </div>
    <div class="goods-info">
      <div class="image">
        <ImagePlayer1
          v-if="goods.name"
          :video="goods.video"
          :banners="goods.banner"
        />
      </div>
      <Infos v-if="goods.name" :goods="goods" @updata="getGoodsDetails" />
      <div class="shop"><Shops v-if="goods.name" :goods="goods" /></div>
    </div>
    <div class="goods-details">
      <div class="left">
        <div class="title">店铺搜索</div>
        <div class="shop-ss">
          <input class="keyword" placeholder="请输入关键字" type="text" />
          <div class="price-range">
            <input type="number" placeholder="最低价" /> ~
            <input type="number" placeholder="最高价" />
          </div>
          <div class="btn">店内搜索</div>
        </div>
        <div class="title">店内分类</div>
        <ClassList1 />
        <div class="title">相关分类</div>
        <ClassList1 />
      </div>
      <div class="right">
        <div class="title">商品详情</div>
        <div class="content" v-html="goods.detail">
          <div class="info">
            <div class="tit">商品名称：</div>
            <span>威力狮钢丝钳 老虎钳 双色炳 斜嘴钳 钳子</span>
          </div>
          <div class="info">
            <div class="tit">商品参数：</div>
            <span
              >颜色：红色、绿色、蓝色、咖啡色、橙色<br />
              尺寸：小号、中号、大号、特大号</span
            >
          </div>
          <img
            width="100%"
            src="https://dss0.bdstatic.com/6Ox1bjeh1BF3odCf/it/u=1209066132,765028587&fm=218&app=92&f=JPEG?w=121&h=75&s=7AA517668FA1ACC0161DB7B30200F085"
            alt=""
          />
        </div>
        <YouLike1 />
      </div>
    </div>
  </div>
</template>

<script>
import api from "@/api";
import ImagePlayer1 from "@/components/ImagePlayer/ImagePlayer1.vue";
import ClassList1 from "@/components/ClassList/ClassList1.vue";
import YouLike1 from "@/components/YouLike/YouLike1";
import Infos from "./infos";
import Shops from "./shops";
export default {
  name: "GoodsDetails",
  components: { ImagePlayer1, ClassList1, Infos, Shops, YouLike1 },
  data() {
    return {
      id: 0,
      goods: {},
      select_spec: [],
    };
  },
  created() {
    this.getGoodsDetails();
  },
  methods: {
    async getGoodsDetails() {
      let id = parseInt(this.$route.params.id);
      let result = await api.GOODS_DETAILS({ id });
      console.log(result);
      this.goods = result;
    },
  },
};
</script>

<style lang="scss" scoped>
.content {
  background: #fff;
  .href-box {
    background: #f6f6f8;
    padding: 20px 0;
    .href {
      max-width: 1200px;
      font-size: 0;
      line-height: 22px;
      margin: 0 auto;
      i {
        padding: 0 10px;
        vertical-align: inherit;
      }
      .link {
        display: inline-block;
        font-size: 16px;
        font-weight: 400;
        color: #333333;
        line-height: 22px;
      }
    }
  }
  .goods-info {
    max-width: 1200px;
    margin: 0 auto 24px;
    display: flex;
    .image {
      width: 440px;
      margin-right: 20px;
    }
    .shop {
      flex: 1;
      margin-top: 20px;
      height: 528px;
      padding: 0 20px;
      border-left: 2px solid #dedede;
    }
  }
  .goods-details {
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    .left {
      width: 220px;
      margin-right: 20px;
      .title {
        width: 220px;
        height: 44px;
        box-sizing: border-box;
        background: #f3f5f9;
        border-radius: 5px 5px 0px 0px;
        border: 1px solid #f0f0f0;
        font-size: 16px;
        font-weight: 500;
        color: #333333;
        line-height: 22px;
        padding: 0 12px;
        display: flex;
        align-items: center;
      }
      .shop-ss {
        width: 220px;
        box-sizing: border-box;
        background: #ffffff;
        border-radius: 0px 0px 5px 5px;
        padding-top: 1px;
        border: 1px solid #f0f0f0;
        display: flex;
        flex-direction: column;
        align-items: center;
        margin-bottom: 20px;
        .keyword {
          width: 174px;
          padding: 0 12px;
          margin: 16px 12px 7px !important;
          height: 26px;
          background: #ffffff;
          border-radius: 5px;
          border: 1px solid #f0f0f0;
        }
        .price-range {
          width: 100%;
          box-sizing: border-box;
          display: flex;
          padding: 0 12px;
          justify-content: space-between;
          align-items: center;
          font-size: 14px;
          font-weight: 400;
          color: #999999;
          line-height: 20px;
          input {
            text-align: center;
            width: 60px;
            padding: 0 12px;
            height: 26px;
            background: #ffffff;
            border-radius: 5px;
            border: 1px solid #f0f0f0;
          }
        }
        .btn {
          margin: 16px 0;
          width: 196px;
          height: 32px;
          background: #d52c1a;
          border-radius: 5px;
          display: flex;
          justify-content: center;
          align-items: center;
          font-size: 14px;
          font-weight: 400;
          color: #ffffff;
          line-height: 20px;
        }
      }
    }
    .right {
      flex: 1;
      width: 0;
      .title {
        width: 120px;
        height: 44px;
        background: #f7f7f7;
        border-radius: 5px 5px 0px 0px;
        border: 1px solid #f0f0f0;
        font-size: 16px;
        font-weight: 500;
        color: #d52c1a;
        line-height: 22px;
        display: flex;
        justify-content: center;
        align-items: center;
      }
      .content {
        background: #ffffff;
        border: 1px solid #f0f0f0;
        padding: 20px;
        .info {
          font-size: 14px;
          font-weight: 400;
          color: #333333;
          line-height: 20px;
          display: flex;
          margin-bottom: 12px;
        }
      }
      .title1 {
        margin: 40px 0 26px;
        font-size: 24px;
        font-weight: 600;
        color: #333333;
        line-height: 33px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        span {
          font-size: 16px;
        }
      }
      .goods-list {
        font-size: 0;
        div {
          border-color: #f2f2f2;
        }
        & div:nth-child(4n + 1) {
          margin-left: 0;
        }
      }
    }
  }
}
</style>
